unit LMDClasses;

{
  LMDClasses 0.1
  last update: 2007/08/21
  author: Shinya Okano
  license: BSD
}

interface

uses
  Windows;

type
  TFrameTimer = class
  private
    fBaseTime: Extended;
    function GetTime: Extended;
  public
    constructor Create;
    procedure Reset;
    property BaseTime: Extended read fBaseTime write fBaseTime;
    property Time: Extended read GetTime;
  end;  

implementation

{ begin TFrameTimer }

constructor TFrameTimer.Create;
begin
  Reset;
end;

procedure TFrameTimer.Reset;
var
  QPFreq, QPCount: Int64;
begin
  QueryPerformanceFrequency(QPFreq);
  QueryPerformanceCounter(QPCount);
  fBaseTime := (QPCount / QPFreq);
end;

function TFrameTimer.GetTime: Extended;
var
  QPFreq, QPCount: Int64;
begin
  QueryPerformanceFrequency(QPFreq);
  QueryPerformanceCounter(QPCount);
  Result := (QPCount / QPFreq) - fBaseTime;
end;

{ end TFrameTimer }

end.